package ChainOfResponsibilityPattern;

public abstract class Logger {
    private static final int INFO = 1;
    private static final int DEBUG = 2;
    private static final int ERROR = 3;

    protected Logger nextLogger;
    protected int level;

    public Logger(Logger nextLogger) {
        this.nextLogger = nextLogger;
    }

    public Logger() {
    }

    public void setNextLogger(Logger logger){
        this.nextLogger = logger;
    }

    protected void loggerMessage(int level, String message){
        if(level == this.level){
            write(message);
        }else{
            nextLogger.loggerMessage(level, message);
        }
   }

   abstract void write(String message);
}
